package net.yxsoft.controller.common;

import com.jfinal.core.ActionKey;
import com.jfinal.upload.UploadFile;

import net.yxsoft.service.infrastructure.CodeService;
import rapid.jfinal.BaseController;

/**
 * 公共接口控制器
 */
public class ApiController extends BaseController {

  private static CodeService srv = CodeService.INSTANCE;

  @ActionKey("/product")
  public void findBy(){

    String code = getPara();

    renderJson(code);
  }

  /**
   * 上传
   */
  public void upload() {
    UploadFile file = getFile();
    renderJson("/files/" + file.getFileName());
  }

  /**
   * 上传
   */
  public void webUpload() {
    renderJson(uploadFile());
  }
}
